home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / qbfaqr01.zip / PCXREAD.BAS < prev    next >
BASIC Source File  |  1992-08-10  |  2KB  |  61 lines

  1. 'From: BRENT ASHLEY
  2. 'Subj: PICTURES WITH QBASIC
  3. '---------------------------------------------------------------------------
  4. 'Here's a PCX loader I found and played with some time ago.  There are no
  5. 'comments and I'm not sure about converting to other screen modes, but
  6. 'it's a start and you're welcome to it.  For speed, you'll want to either
  7. 'modify this to write to an invisible page and then make the page visible
  8. '(apparent speed), or find a library with PCX routines (some of Tom
  9. 'Hanlin's have them) written in assembler.
  10.  
  11. DEFINT A-Z
  12. DECLARE SUB PCXLOAD (File$)
  13.  
  14. CLS
  15. PCXLOAD "MyFile.PCX"
  16. WHILE INKEY$ = "": WEND
  17.  
  18. SUB PCXLOAD (File$) STATIC
  19.   SCREEN 11, , 0
  20.   OPEN File$ FOR INPUT AS #1 LEN = 16384
  21.   SEEK #1, 129
  22.   DEF SEG = &HA000
  23.   FOR ScrLin = 0 TO 479
  24.     Addr& = 80& * ScrLin
  25.     LinStrt& = Addr&: LinEnd& = Addr& + 80
  26.     Plane = 1
  27.     OUT &H3C4, 2: OUT &H3C5, Plane
  28.     DO WHILE Plane <= 8
  29.       Byte = ASC(INPUT$(1, 1))
  30.       IF EOF(1) THEN EXIT FOR
  31.       IF (Byte AND 192) <> 192 THEN
  32.         POKE Addr&, Byte
  33.         Addr& = Addr& + 1
  34.         IF Addr& >= LinEnd& THEN
  35.           Addr& = LinStrt&
  36.           Plane = Plane * 2
  37.           OUT &H3C4, 2: OUT &H3C5, Plane
  38.         END IF
  39.       ELSE
  40.         Byte = Byte AND 63
  41.         Byte2 = ASC(INPUT$(1, 1))
  42.         IF EOF(1) THEN EXIT FOR
  43.         FOR Expand = 1 TO Byte
  44.           POKE Addr&, Byte2
  45.           Addr& = Addr& + 1
  46.           IF Addr& >= LinEnd& THEN
  47.             Addr& = LinStrt&
  48.             Plane = Plane * 2
  49.             OUT &H3C4, 2: OUT &H3C5, Plane
  50.           END IF
  51.         NEXT
  52.       END IF
  53.     LOOP
  54.   NEXT
  55.   OUT &H3C4, 2: OUT &H3C5, &HF
  56.   DEF SEG
  57.   CLOSE #1
  58. END SUB
  59.  
  60. ' end of program
  61.